﻿<%@ Page Title="ХочуБукет - заказ и доставка цветов" Language="C#" MasterPageFile="~/Site.master"
    AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FlowersStore._Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div class="AroundMainMenu">
        <div class="LeftMenuCol">
        </div>
        <div class="menuCol">
            <div class="MainMenuSearch">
                <div class="MainMenueSearchTool">
                    <asp:TextBox ID="TextBoxSearch" runat="server" Width="168px" Height="32px" BorderStyle="None"
                        BorderWidth="0" CssClass="SearchField" Font-Size="Medium" ToolTip="Введите цветок для поиска">Поиск</asp:TextBox>
                </div>
                <div class="MainMenuSearchGlass">
                    <asp:ImageButton ID="btnSearch" ImageUrl="Styles/Images/Search.png" runat="server"
                        OnClick="SearchGo" />
                    <%--<a style="text-decoration: none" href="Search.aspx">
                        <img onclick="SearchGo" alt="Поиск" src="Styles/Images/Search.png" />
                    </a>--%>
                </div>
            </div>
            <asp:ScriptManager ID="ScriptManager" runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:TreeView ID="TreeViewMainMenu" runat="server" OnSelectedNodeChanged="TreeViewMainMenu_SelectedNodeChanged"
                        ShowExpandCollapse="False" RootNodeStyle-CssClass="MenuRootNodeStyle">
                        <RootNodeStyle CssClass="MenuRootNodeStyle" />
                        <LeafNodeStyle HorizontalPadding="24" CssClass="MenuLeafNodeStyle" />
                    </asp:TreeView>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    <div class="mainContent">
        <asp:ListView ID="ListView_Products" runat="server" DataKeyNames="Product_id" DataSourceID="ProductsSqlDataSource"
            GroupItemCount="3" OnSorting="SortByPrice">
            <EmptyDataTemplate>
                <layouttemplate>
                <table cellspacing="0" id="ProductTable" runat="server">
                    <tr>
                        <td colspan="2" style="padding: 2px 4px 2px 8px; border-bottom-style: solid; border-bottom-width: 5px;
                            border-bottom-color: White; background-color: #cccccc;">
                            Позиций в разделе
                            <asp:Label ID="LabelCat" runat="server"></asp:Label>:&nbsp;
                            <asp:Label ID="LabelNum" runat="server" Text="0"></asp:Label>
                        </td>
                    </tr>
                    </table>
                    </layouttemplate>
                <tt class="EmptyCategory">Цветы данной категории ещё растут. 
                <br> </br> Выберите свежие цветы из
                    других категорий. Спасибо. </tt>
            </EmptyDataTemplate>
            <EmptyItemTemplate>
                <td runat="server" />
            </EmptyItemTemplate>
            <GroupTemplate>
                <tr id="itemPlaceholderContainer" runat="server">
                    <td id="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </GroupTemplate>
            <ItemTemplate>
                <td runat="server" style="padding: 15px;">
                    <tt class="ProductName">
                        <asp:Label ID="Product_nameLabel" runat="server" Text='<%# Eval("Product_name") %>' />
                    </tt>
                    <br />
                    <tt class="ProductArticle">Артикул:
                        <asp:Label ID="Product_articleLabel" runat="server" Text='<%# Eval("Product_article") %>' />
                    </tt>
                    <br />
                    <div class="ProductPreView" runat="server">
                        <div style="margin-left: -4px; margin-top: 5px; text-align: center;">
                            <img alt="Цветок" src='<%# Eval("Product_thimbnailUrl") %>' />
                        </div>
                    </div>
                    <br />
                    <div>
                        <tt class="ProductPrice">
                            <asp:Label ID="Product_priceLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Product_price","{0:n0}") %>' />
                            руб. </tt>
                        <%--<br />--%>
                        <span class="ProductBuy">
                            <%--<a href="Cart.aspx" style="text-decoration: none;">
                            <img alt="В корзину" src="Styles/Images/InCart.png" />
                        </a>--%>
                            <asp:ImageButton AlternateText="В корзину" ImageUrl="Styles/Images/InCart.png" ID="btnInCart"
                                OnClick="btnInCart_Click" runat="server" CommandArgument='<%# Eval("Product_id") %>' />
                        </span>
                    </div>
                    <span><tt class="ProductViewDetails">
                        <asp:HyperLink ID="LinkButton1" runat="server" NavigateUrl='<%# "productdetails.aspx?product="+Eval("Product_id") %>'>
                        Подробнее... </asp:HyperLink>
                    </tt></span>
                </td>
            </ItemTemplate>
            <LayoutTemplate>
                <table cellspacing="0" id="ProductTable" runat="server">
                    <tr>
                        <td colspan="2" style="padding: 2px 4px 2px 8px; border-bottom-style: solid; border-bottom-width: 5px;
                            border-bottom-color: White; background-color: #cccccc;">
                            Позиций в разделе
                            <asp:Label ID="LabelCat" runat="server" Text="Label"></asp:Label>:&nbsp;
                            <asp:Label ID="LabelNum" runat="server" Text="Label"></asp:Label>
                        </td>
                    </tr>
                    <tr style="background-color: #cccccc;" id="ProductTr1" runat="server">
                        <td id="Td1" runat="server" style="padding: 2px 4px 0px 18px;">
                            <asp:DataPager ID="DataPager2" runat="server" PageSize="9">
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Image" ShowFirstPageButton="True" ShowNextPageButton="False"
                                        ShowPreviousPageButton="True" NextPageText="Следующая страница" FirstPageText="В начало"
                                        LastPageText="В конец" PreviousPageText="Предыдущая страница" ShowLastPageButton="False"
                                        FirstPageImageUrl="Styles/Images/go-first.png" PreviousPageImageUrl="Styles/Images/go-previous.png" />
                                    <asp:NumericPagerField ButtonCount="3" NumericButtonCssClass="NumericButton" CurrentPageLabelCssClass="CurrentButton" />
                                    <asp:NextPreviousPagerField ButtonType="Image" ShowLastPageButton="True" ShowNextPageButton="True"
                                        ShowPreviousPageButton="False" LastPageText="В конец" NextPageText="Следующая страница"
                                        LastPageImageUrl="Styles/Images/go-last.png" NextPageImageUrl="Styles/Images/go-next.png" />
                                </Fields>
                            </asp:DataPager>
                        </td>
                        <td class="ProductsSort">
                            <tt class="NumericButton">Цена:&nbsp;&nbsp;<span class="PriceSort"><asp:ImageButton
                                ID="btnTop" CommandName="Sort" CommandArgument="Product_price" runat="server"
                                ImageUrl="Styles/Images/view-sort-ascending.png" ToolTip="По возрастанию цены" />
                            </span><tt />
                        </td>
                    </tr>
                    <tr runat="server">
                        <td colspan="2" runat="server">
                            <table id="groupPlaceholderContainer" runat="server" border="0" style="">
                                <tr id="groupPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr style="background-color: #cccccc;" id="Tr1" runat="server">
                        <td id="Td2" runat="server" style="padding: 2px 4px 0px 18px;">
                            <asp:DataPager ID="DataPager1" runat="server" PageSize="9">
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Image" ShowFirstPageButton="True" ShowNextPageButton="False"
                                        ShowPreviousPageButton="True" NextPageText="Следующая страница" FirstPageText="В начало"
                                        LastPageText="В конец" PreviousPageText="Предыдущая страница" ShowLastPageButton="False"
                                        FirstPageImageUrl="Styles/Images/go-first.png" PreviousPageImageUrl="Styles/Images/go-previous.png" />
                                    <asp:NumericPagerField ButtonCount="3" NumericButtonCssClass="NumericButton" CurrentPageLabelCssClass="CurrentButton" />
                                    <asp:NextPreviousPagerField ButtonType="Image" ShowLastPageButton="True" ShowNextPageButton="True"
                                        ShowPreviousPageButton="False" LastPageText="В конец" NextPageText="Следующая страница"
                                        LastPageImageUrl="Styles/Images/go-last.png" NextPageImageUrl="Styles/Images/go-next.png" />
                                </Fields>
                            </asp:DataPager>
                        </td>
                        <td class="ProductsSort">
                            <tt class="NumericButton">Цена:&nbsp;&nbsp;<span class="PriceSort"><asp:ImageButton
                                ID="btnBottom" CommandName="Sort" CommandArgument="Product_price" runat="server"
                                ImageUrl="Styles/Images/view-sort-ascending.png" ToolTip="По возрастанию цены" />
                            </span><tt />
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="ProductsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:FlowerStoreConnectionString %>"
            SelectCommand="GetCategoryProducts" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="CategoryId" QueryStringField="category"
                    Type="Int64" />
            </SelectParameters>
        </asp:SqlDataSource>
    </div>
</asp:Content>
